ReplaceChild (): Method replaces one child node within a given parent element with another child node:Referencre = Element.replacechild (newchild,oldchild);The Oldchild node must be an element child node whose return value is a reference pointer to
This article mainly introduces how to use javascript to replace existing elements with replaceChild (). For more information, see replaceChild (a, B ).
Parameter a: the node to be inserted,
Parameter B: the node to be replaced
The Code is as
ReplaceChild (a, B) is used to replace existing elements in the document.Parameter a: the node to be inserted,Parameter B: the node to be replacedCopy codeThe Code is as follows:Var oDiv = document. getElementById ("guoDiv ");Var oSpan = document.
DOM node replacement or modification function replaceChild () usage instance, domreplacechild
This example describes how to replace or modify the replaceChild () function of a DOM node. Share it with you for your reference. The specific analysis is
The example in this article describes the substitution or modification function replacechild () Usage of a DOM node. Share to everyone for your reference. The specific analysis is as follows:
The replacement process for DOM nodes:(1) Create a new
This article mainly introduces the use of JavaScript replacement elements ReplaceChild (), need friends can refer to the followingReplaceChild (A,B) is a parameter that replaces an existing element in a document A: the node to be inserted, parameter
ReplaceChild (A,B) is used to replace an existing element in a document.
Parameter A: the node to insert,
Parameter B: the node to replace
Copy Code code as follows:
var odiv = document.getElementById ("Guodiv");
var Ospan =
The principle is basically like this. If strings are input, convert them into an element node. However, this element node can also have many layers and put the elements to be wrapped in the innermost layer. There are several methods to convert a
Next, write the method in the last XMLDOC. The main methods of Document are:
1. abort2. appendChild3. cloneNode4. createAttribute5. createCDATASection6. createComment7. createdocument. ragment8. createElement9. createEntityReference10. createNode11.
Imitating jquey and creating several package nodes, we found that jquery is inefficient. Next time, he could say how much these methods can be improved. The principle is basically like this. If strings are input, convert them into an element node.
If (! Document. all ){// Zzcv ff ie compatible script/* Unresolved issues and handling of the script:2. in IE, you can use () or [] to obtain the collection class object. In Firefox, you can only use [] to obtain the collection class object.Solution:
I. Element Node // test element node, output node name, node type, and node value varliElementsdocument. getElementsByTagName (& quot; li & quot;); for (vari0; I & lt; liElements. length; I ++) {alert (liElements [I]. nodeName);
I. Element nodes
//
dom|xml| objects
Abort method
RoleAbort method cancels an asynchronous download in progress
Basic syntax
Xmldocument.abort ();
Description
If this method is called when downloading asynchronously, all parsing actions are stopped, and the files in
If (! Document. All ){
// Zzcv FF ie compatible script
/* Unresolved issues and handling of the script:
2. in IE, you can use () or [] to obtain the collection class object. In Firefox, you can only use [] to obtain the collection class
1. Create a node
The createelement () method creates a new element node based on the given tag name. Its nodetype attribute value is 1.
The createtextnode () method creates a new text node that contains the given text. Its nodetype attribute value
Unified interface: Add IE methods and attributes to FireFox. How does one run the code (pure js version) in Z-Blog? Because FF does not support insertAdjacentElement, the "Running code" link cannot be displayed. Today, I Googled and found a good
This article introduces how to enhance node content in javascript.
I. Element nodes
The Code is as follows:
// Test the element node, output node name, node type, and node ValueVar liElements = document. getElementsByTagName ("li ");For (var I = 0;
Load Method
For useIndicates the file to be loaded from the specified position.Basic syntaxBoolvalue = xmldocument. Load (URL );
DescriptionThe URL contains the string of the URL of the file to be loaded. If the file is successfully loaded, the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.